<template>
  <view class="allContaienr" @click="handleClick">
    <view class="itemContent">
      <view class="itemAction">
        <text class="itemName">{{ itemObj.repoTitle }}</text>
        <view
          v-if="btnTitle.length"
          class="itemRightBtn"
          @click.stop="handleRightBtnClick"
          >{{ btnTitle }}</view
        >
        <view
          v-else
          class="itemRightBtn"
          style="color: darkgray"
          @click.stop="handleRightBtnClick"
          >删除</view
        >
        <!-- <view v-if="btnTitle.length" class="itemRightBtn" @click.stop="handleRightBtnClick">{{ btnTitle }}</view>
        <view v-else-if="itemObj.interviewStatus == 'started'" class="itemRightBtn" @click.stop="handleRightBtnClick">删除</view>
        <view v-else class="itemRightBtn" style="color: darkgray;">{{ itemObj.interviewStatusName }}</view> -->
      </view>
      <text class="itemResultNum"
        >共<text class="red">{{
          itemObj.requestCount ? itemObj.requestCount : 0
        }}</text
        >个面试问题</text
      >
      <text class="itemTime">创建时间：{{getMdate(itemObj.createTime) }}</text>
    </view>
  </view>
</template>

<script>
import common from '@/api/common.js';
export default {
  props: {
    btnTitle: {
      type: String,
      default: "",
    },

    itemObj: {
      type: Object,
      default: function () {
        return {
          id: "1665531282287673345",
          interviewStatus: "started",
          interviewStatusName: "已开始",
          interviewTitle: "测试招聘6",
          resultNum: 0,
          validEndTime: 1687665600000,
          validStartTime: 1685923200000,
        };
      },
    },

    // cellTap: {
    //   type: Function,
    //   required: false
    // },
    // interviewBtn: {
    //   type: Function,
    //   required: false
    // },
  },

  data() {
    return {};
  },

  methods: {
    handleClick() {
      // this.cellTap(this.itemObj);
      this.$emit("cellTap", this.itemObj);
    },

    handleRightBtnClick() {
      // this.interviewBtn(this.itemObj);
      this.$emit("subBtn", this.itemObj);
    },

    getMdate(date) {
      return common.getMinuteTime(date) 
    },

  },
};
</script>

<style lang="scss" scoped>
.allContaienr {
  display: flex;
  background: white;
  border-radius: 32rpx;
  justify-content: space-between;
  flex-direction: row;
  padding: 32rpx;
  margin: 32rpx;

  .itemContent {
    display: flex;
    flex-direction: column;
    width: 100%;
    .red {
      font-size: 32rpx;
      color: #f75a3e;
      margin: 0 10rpx;
    }
    .itemName {
      flex: 1;
      font-size: 32rpx;
      color: #222222;
      font-family: PingFang-SC-Heavy, PingFang-SC;
      font-weight: 800;
    }
    .itemResultNum {
      margin-top: 16rpx;
      font-size: 28rpx;
      color: #555555;
    }

    .itemTime {
      margin-top: 16rpx;
      font-size: 28rpx;
      color: #999;
    }
    .itemAction {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
    }
  }

  .itemRightBtn {
    width: auto;
    display: flex;
    align-items: flex-end;
    font-size: 28rpx;
    color: #f75a3e;
  }
}
</style>
